<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;

/**
 * 搜索控制器
 * @author:sunbirder
 */
class SearchController extends HomeController {

    
	public function index(){
        $title = trim(I('title'));
        if(IS_POST && $title){
            $where = array();
            $where['title'] = array('like',array("%$title%"));
            $where['status'] = 1;
            $searchList = D('Document')->where($where)->select();
            foreach($searchList as &$arr){
                $article = M('DocumentArticle')->field('bookmark')->find($arr['id']);
                $arr = array_merge($arr, $article);
            }
            $this->assign('searchList', $searchList);
        }
		$this->display();
	}

	

}
